package com.xf.system.exception;

/**
 * @author xiefengf
 */

public class CodeAndMessage {
    private Integer code;
    private String message;

    public CodeAndMessage() {
    }

    public CodeAndMessage(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static CodeAndMessage create(Integer code, String message) {
        return new CodeAndMessage(code, message);
    }

    public Integer getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    public void setCode(final Integer code) {
        this.code = code;
    }

    public void setMessage(final String message) {
        this.message = message;
    }

    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof CodeAndMessage)) {
            return false;
        } else {
            CodeAndMessage other = (CodeAndMessage)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$code = this.getCode();
                Object other$code = other.getCode();
                if (this$code == null) {
                    if (other$code != null) {
                        return false;
                    }
                } else if (!this$code.equals(other$code)) {
                    return false;
                }

                Object this$message = this.getMessage();
                Object other$message = other.getMessage();
                if (this$message == null) {
                    return other$message == null;
                } else return this$message.equals(other$message);
            }
        }
    }

    protected boolean canEqual(final Object other) {
        return other instanceof CodeAndMessage;
    }

    public int hashCode() {
        int result = 1;
        Object $code = this.getCode();
        result = result * 59 + ($code == null ? 43 : $code.hashCode());
        Object $message = this.getMessage();
        result = result * 59 + ($message == null ? 43 : $message.hashCode());
        return result;
    }

    public String toString() {
        return "CodeAndMessage(code=" + this.getCode() + ", message=" + this.getMessage() + ")";
    }
}
